package com.twu.biblioteca;

public enum UserInputOptions {

    INVALID_OPTION(0), LOGIN(1), LIST_BOOKS(2), RESERVE(3), MEMBERSHIP_DETAILS(4), LIST_MOVIES(5), LOGOUT(6), EXIT(7);

    private int code;

    private UserInputOptions(int code) {
        this.code = code;
    }

    public int toInt() {
        return code;
    }

    public static UserInputOptions valueOf(int userInput) {
       switch (userInput) {
           case 1: return LOGIN;
           case 2: return LIST_BOOKS;
           case 3: return RESERVE;
           case 4: return MEMBERSHIP_DETAILS;
           case 5: return LIST_MOVIES;
           case 6: return LOGOUT;
           case 7: return EXIT;
           default: return INVALID_OPTION;
       }
    }
}
